<?php
$SITEROOT = '../';
include_once($SITEROOT . 'assets/snippets/shoppingCart/dbconfig.inc.php');
include_once($SITEROOT . 'assets/snippets/shoppingCart/kiwee.class.php');

$kiwee = new Kiwee();

if(IN_MANAGER_MODE!="true") die('<b>' . $_lang['kiwee_include_order_error'] . '</b>');
if ($_SESSION['mgrPermissions']['settings'] != "1") { echo 'Insufficient permissions for this module.'; exit; }

$theme = $manager_theme ? "$manager_theme/":"";
// initialize page view state - the $_PAGE object
$modx->manager->initPageViewState();

// get and save search string
if($_REQUEST['op']=='reset') {
	$sqlQuery = $query = '';
	$_PAGE['vs']['search']='';
}
else {
	$sqlQuery = $query = isset($_REQUEST['search'])? $_REQUEST['search']:$_PAGE['vs']['search'];
	if(!is_numeric($sqlQuery)) $sqlQuery = mysql_escape_string($query);
	$_PAGE['vs']['search'] = $query;
}

// get & save listmode
$listmode = isset($_REQUEST['listmode']) ? $_REQUEST['listmode']:$_PAGE['vs']['lm'];
$_PAGE['vs']['lm'] = $listmode;

// context menu
include_once $base_path . "manager/includes/controls/contextmenu.php";
$cm = new ContextMenu("cntxm", 150);
$cm->addItem($_lang["view_log"],"js:menuAction(1)","media/style/" . ($manager_theme ? "$manager_theme/":"") ."images/icons/save.gif");
$cm->addSeparator();
$cm->addItem($_lang["delete"], "js:menuAction(2)","media/style/" . ($manager_theme ? "$manager_theme/":"") ."images/icons/delete.gif",(!$modx->hasPermission('delete_eventlog') ? 1:0));
echo $cm->render();
?>
<script type="text/javascript" src="js/prototype.js"></script>
<script type="text/javascript" src="js/modal_window/javascripts/modal.js"></script>
<script type="text/javascript" src="actions/includes/interface.js"></script>
<script type="text/javascript">
	function ajaxrendercomponent(name) {
		if (name == 'editdropdowngrid'){ 
			document.getElementById('editdropdowngrid').innerHTML=http_request.responseText; 
		} else if (name == 'editlistoptionproperties'){
            showBox();
            document.getElementById('inner-box').innerHTML=http_request.responseText;
		} else if (name == 'addlistoption' || name == 'deletelistoption'){ 
			editlist(document.getElementById('listid').value); 
		} else if (name == 'editlistoption'){
            hideBox();
            listoptionmaintenancegridload();
		} else {
			 alert(name);
		}
	}
</script>
<link href="js/modal_window/stylesheets/modal.css" rel="stylesheet" type="text/css" />

<div id="overlay" onclick="hideBox()" style="display:none"></div>
	
<div id="box" style="display:none">
	<img id="close" src="js/modal_window/images/close.gif" onclick="hideBox()" alt="Close"
		title="Close this Window" />
	<div id="title" style="color: #ff9933; font-weight: bold; font-size: 14px;">
	List Item Changes
	</div>
	<br />
	<div id="inner-box">
	</div>
</div>
<link href="actions/includes/kiwee.css" rel="stylesheet" type="text/css" />
<div class="kiwee-msc" id="mascot"><a href="http://www.kiweecommerce.org"><img src="actions/includes/Kiwee-small.gif" /></a></div>
		
<div class="subTitle">
<span class="right"></span>
</div>
<input type="hidden" name="id" value="<?php echo $id; ?>" />
<input type="hidden" name="listmode" value="<?php echo $listmode; ?>" />
<input type="hidden" name="op" value="" />

<div class="sectionHeader"><?php echo $_lang["list_item_maintenance_header"]; ?></div>
<div class="sectionBody">
	<p><?php echo $_lang['list_item_maintenance_description']; ?></p>
	<p style="font-weight: bold; font-size: 14px;">Items for list: <?php echo " " . $_POST['listname']; ?></p>
<div>
	<input type="hidden" id="listid" name="listid" value="<?php echo $_POST['listid']; ?>" />
	<div id="editdropdowngrid" name="editdropdowngrid" >
	<script>
		listoptionmaintenancegridload();
	</script>
	</div>
	<button id="returnToLists" onClick="location.href='index.php?a=406';" >Return to List Maintenance</button>
</div>